﻿using System;
using System.Runtime.Serialization;

namespace StreetPacMan.Server.Facade
{
    [DataContract]
    public class ServerPollResult
    {
        public ServerPollResult(ClientEntity[] players,  int[] removedAppleIds, ClientMessage[] recentMessages, GameState gameState, int gameScore, int pacMenLeft)
        {
            Players = players;
            RemovedAppleIds = removedAppleIds;
            RecentMessages = recentMessages;
            GameState = gameState;
            Score = gameScore;
            PacMenLeft = pacMenLeft;
        }

        [DataMember]
        public ClientEntity[] Players { get; private set; }
        [DataMember]
        public int[] RemovedAppleIds { get; private set; }

        [DataMember]
        public ClientMessage[] RecentMessages { get; private set; }

        [DataMember]
        public GameState GameState { get; private set; }

        [DataMember]
        public int Score { get; private set; }
        [DataMember]
        public int PacMenLeft { get; private set; }
    }

    [DataContract]
    public class ClientMessage
    {
        [DataMember]
        public int Id { get; private set; }

        [DataMember]
        public string SenderName { get; private  set; }
        [DataMember]
        public DateTime SentAt { get; private set; }
        [DataMember]
        public string Body { get; private set; }

        public ClientMessage(int id, string senderName, DateTime sentAt, string body)
        {
            Id = id;
            SenderName = senderName;
            SentAt = sentAt;
            Body = body;
        }
    }
}